<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ include file="../common/jsptag.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="keywords" content="${systemParamMap["sitekey"].paramValue}" />
    <meta name="description" content="${systemParamMap["sitedesc"].paramValue}" />
    <meta name="author" content="${systemParamMap["siteauthor"].paramValue}" />
    <title>友情网站链接申请页</title>
    <script src="<%=request.getContextPath() %>/js/jquery-1.7.1.min.js"></script>
    <script src="<%=request.getContextPath() %>/js/common.js" type="text/javascript"></script>
    <link href="<%=request.getContextPath() %>/css/main.css" rel="stylesheet" type="text/css" />
    <link rel="ShortcutIcon" href="favicon.ico" type="image/x-icon" />
    <link rel="Bookmark" href="favicon.ico" />
    <script type="text/javascript">
        function toggleImageCode() {
            var imageCode = document.getElementById('imageCode');
            imageCode.src = "/verifyCode?"+Math.random();
            imageCode.style.display = "inline";
        }
        function refreshCode() {
            var imageCode = document.getElementById('imageCode');
            imageCode.src = "/verifyCode?"+Math.random();
        }
        function submitApply() {
            var siteName = document.applyForm.siteName.value;
            var siteDomain = document.applyForm.siteDomain.value;
            var siterMail =  document.applyForm.siterMail.value;
            var imageCode = document.applyForm.imageCode.value;

            if (siteName == null || siteName == '') { alert('网站名称不能为空'); return; }
            if (siteDomain == null || siteDomain == '') { alert('网站域名不能为空'); return; }
            if (siterMail == null || siterMail == '') { alert('站长邮箱不能为空'); return; }
            if (imageCode == null || imageCode == '') { alert('图片验证码不能为空'); return; }

            var domainExp = new RegExp('.*www\\..*\\..*', 'g');
            if (!siteDomain.match(domainExp)) { alert('无效的网站域名格式，请正确填写！\n格式：http://www.5ifilm.net 或者 www.5ifilm.net'); return; }

            var mailExp = new RegExp('.*@.*\\..*', 'g');
            if (!siterMail.match(mailExp)) { alert('无效的站长邮箱格式，请正确填写！\n格式：xxxx@xxxx.com'); return; }

            document.applyForm.action = 'applyAccessSite.html';
            document.applyForm.method = 'POST';
            document.applyForm.submit();
        }

        function imageCodeSubmit() {
            var event = window.event || arguments[0];
            if (event.keyCode == 13) {
                submitApply();
            }
        }

    </script>
</head>
<body>

	<div id="main">
			
			<jsp:include page="../header.jsp"></jsp:include>
	
			<div class="height1">&nbsp;</div>
	
			<div style="width: 1003px; padding: 0; ">
				<div class="nav_box2_t">
					<div class="nav_box2_t">
			            <div class="nav2_t_m">
			                <div class="nav_title1">
			                <font class="fot2">请填写链接申请资料</font>
			                </div>
			            </div>
			            <div class="nav2_t_l"></div>
			            <div class="nav2_t_r"></div>
			        </div>
			        <div class="nav_box2_m">
						<div class="chromestyle1">
                            <c:choose>
                                <c:when test="${message == null}">
                                    <form name="applyForm">
                                        <div class="apply">
                                            <ul class="btn_nomal">
                                                <li style="background: url('') no-repeat scroll 0 0 rgba(0, 0, 0, 0);">
                                                    网站名称：<input class="input_text_normal" type="text" name="siteName"/>
                                                </li>
                                                <li style="background: url('') no-repeat scroll 0 0 rgba(0, 0, 0, 0);">
                                                    网站域名：<input class="input_text_normal" type="text" name="siteDomain"/>
                                                </li>
                                                <li style="background: url('') no-repeat scroll 0 0 rgba(0, 0, 0, 0);">
                                                    站长邮箱：<input class="input_text_normal" type="text" name="siterMail"/>
                                                </li>
                                                <li style="background: url('') no-repeat scroll 0 0 rgba(0, 0, 0, 0);">
                                                    验证码：<input class="input_text_normal" type="text" size="4" maxlength="4" name="imageCode" onfocus="toggleImageCode();" onkeydown="imageCodeSubmit();"/>
                                                </li>
                                                <li style="background: url('') no-repeat scroll 0 0 rgba(0, 0, 0, 0);">
                                                    <a href="javascript:refreshCode();"><img id="imageCode" width="60" height="21" style="display: none;"></a>
                                                </li>
                                                <li class="btn_m" onclick="javascript:submitApply();">提交</li>
                                            </ul>
                                        </div>
                                    </form>
                                </c:when>
                                <c:otherwise>
                                    <div style="padding-top: 30px; padding-left: 15px;color: #ff0000;">
                                        <ul>
                                            <li>${message}</li>
                                        </ul>
                                    </div>
                                </c:otherwise>
                            </c:choose>
						</div>
					</div>
			        <div class="nav_box2_b">
			            <div class="nav2_b_m"><div class="nav_box_bl1"></div></div>
			            <div class="nav2_b_l"></div>
			            <div class="nav2_b_r"></div>
			        </div>
				</div>
			</div>
	
			<jsp:include page="../footer.jsp"></jsp:include>
	
	</div>

</body>
</html>